Skip to content

add word boundary to del regex to prevent false positives#1120

Open
devarjya27 wants to merge 2 commits intomandiant:masterfrom
devarjya27:improve-self-deletion-rule
Open

add word boundary to del regex to prevent false positives#1120
devarjya27 wants to merge 2 commits intomandiant:masterfrom
devarjya27:improve-self-deletion-rule

Conversation

@devarjya27
Copy link
Contributor

@devarjya27 devarjya27 commented Feb 18, 2026

Closes #1089

  • Added a word boundary \b after del to ensure the pattern only matches the del shell command as a standalone token
  • updated rule passes linting.

- string: /\/c\s*del\s*/
description: "/c del"
- string: /(^|[\&;\|]\s*)del(\s.*)?/i
- string: /(^|[\&;\|]\s*)del\b(\s.*)?/i
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about before del?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mike-hunhoff, Ive updated the regex. Added \b before del.

Additionally, I've added word boundaries around del in the first regex too. The new regex is /\/c\s*\bdel\b\s*/. \s* allows zero spaces, so something like /c delivery.bat could match on the del prefix of a completely benign script. . Having word boundaries across both regexes makes the rule more robust. Lmk what you think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mimikatz.exe_: self delete

2 participants